<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Symbol.prototype.description</title>
</head>
<body>
    <h1>Symbol.prototype.description</h1>
    <h2>用来获取Symbol的描述字符串</h2>

    <script>
        const sym = Symbol('foo');
        console.log(sym.description); // "foo"

        const sym2 = Symbol();
        console.log(sym2.description); // undefined

        // 与toString()的区别
        console.log(sym.toString()); // "Symbol(foo)"
        console.log(sym.description); // "foo"
    </script>
</body>
</html> 